﻿@using YmtRpc.Domain;
@using Webdiyer.WebControls.Mvc;
@model PagedList<ServiceDependencySampling>

<table class="table table-striped table-bordered table-hover">
    <thead>
        <tr>
            <th style="width:50px">序号</th>
            <th>采样ID</th>
            <th>服务消费者</th>
            <th>服务消费者的当前地址</th>
            <th>服务提供者</th>
            <th>服务提供者的接口地址</th>
            <th>采样开始时间</th>
            <th>采样结束时间</th>
            <th>采样周期（秒）</th>
            <th>总接口请求数</th>
            <th>接口请求失败数</th>
            <th>总耗时（毫秒）</th>
            <th>最大耗时（毫秒）</th>
            <th>最小耗时（毫秒）</th>
        </tr>
    </thead>
    <tbody id="samplingDataContent">
        @if (Model != null)
        {
            int i = 0;
            foreach (ServiceDependencySampling sampling in Model)
            {
                <tr>
                    <td>@(Model.StartItemIndex + i++)</td>
                    <td>@sampling.Id</td>
                    <td>@sampling.ConsumerAppId</td>
                    <td>@sampling.ApiName</td>

                    <td>@sampling.ProviderAppId</td>
                    <td>@sampling.ApiPath</td>
                    <td>@sampling.BeginTime</td>

                    <td>@sampling.EndTime</td>
                    <td>@sampling.SamplingElapsedSeconds</td>
                    <td>@sampling.TotalRequestTimes</td>

                    <td>@sampling.TotalFailTimes</td>
                    <td>@sampling.TotalRequestElapsedMilliseconds</td>
                    <td>@sampling.MaxElapsedTime</td>
                    <td>@sampling.MinElapsedTime</td>
                </tr>
            }
        }
    </tbody>
</table>

<div class="text-right">
    <div>
        <div style="float:left;margin:20px 0;">Page @Model.CurrentPageIndex of @Model.TotalPageCount, @Model.TotalItemCount items</div>
        @Ajax.Pager(Model, new PagerOptions { PageIndexParameterName = "p", AlwaysShowFirstLastPageNumber = true, ContainerTagName = "ul", CssClass = "pagination", CurrentPagerItemTemplate = "<li class=\"active\"><a href=\"#\">{0}</a></li>", DisabledPagerItemTemplate = "<li class=\"disabled\"><a>{0}</a></li>", PagerItemTemplate = "<li>{0}</li>" }).AjaxOptions(a => a.SetUpdateTargetId("samplingDataDiv"))

        <div class="input-group" style="float:right;margin:22px 0 20px 5px;">
            <input type="text" id="pagebox" class="form-control input-sm" style="width:100px;" />
            <span class="input-group-btn" style="float:left"><button class="btn btn-primary btn-sm" id="goBtn" onclick="goToPage(); return false;">Go</button></span>
        </div>
    </div>